package com.lizemin.factoryBean;

import com.lizemin.factoryBean.entity.Cat;
import org.springframework.beans.factory.SmartFactoryBean;

/**
 * @author lzm
 * @date 2025/10/22 20:16
 * @description
 */
public class CatFactoryBean implements SmartFactoryBean<Cat> {

    @Override
    public Cat getObject() throws Exception {
        return new Cat("黑猫警长", 38);
    }

    @Override
    public Class<?> getObjectType() {
        return Cat.class;
    }

    /**
     * 是否立即创建对象
     *
     * @return true:表示立即创建对象，false:表示延迟创建对象
     */
    @Override
    public boolean isEagerInit() {
        return true;
    }

    @Override
    public boolean isSingleton() {
        return SmartFactoryBean.super.isSingleton();
    }
}
